// DisplayDialog.cpp : implementation file
//

#include "stdafx.h"
#include "mfcPuppy.h"
#include "DisplayDialog.h"
#include "afxdialogex.h"

// CDisplayDialog dialog

IMPLEMENT_DYNAMIC(CDisplayDialog, CDialog)

CDisplayDialog::CDisplayDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CDisplayDialog::IDD, pParent)
{

}

CDisplayDialog::~CDisplayDialog()
{
}

void CDisplayDialog::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CDisplayDialog, CDialog)
	ON_WM_SIZE()
END_MESSAGE_MAP()


// CDisplayDialog message handlers


BOOL CDisplayDialog::OnInitDialog()
{
	/// <summary>
	/// Create the MFC dialog
	/// </summary>
	CDialog::OnInitDialog();


	/// <summary>
	/// Create the OpenGL display
	/// </summary>
	CRect rect;
	this->GetWindowRect(rect);			// Get size and position of the MFC dialog
	ScreenToClient(rect);				// Convert screen coordinates to client coordinates
	m_oglWindow.oglCreate(rect, this);	// Create OpenGL window -- Windows specific intializations

	// replace this with a thread instead?
	// Setup the OpenGL Window's timer to render
	m_oglWindow.m_unpTimer = m_oglWindow.SetTimer(1, 1, 0);

	return TRUE; 
}

void CDisplayDialog::OnSize(UINT nType, int cx, int cy)
{
	CDialog::OnSize(nType, cx, cy);
	m_oglWindow.OnSize(nType, cx, cy);
}
